<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"anynone.gitee.io","root":"/","images":"/images","scheme":"Pisces","darkmode":true,"version":"8.7.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>
<meta name="description" content="安装包下载 (包含ik分词器)  链接: https:&#x2F;&#x2F;pan.baidu.com&#x2F;s&#x2F;16hZCo46eHkuqW1_HMTj3Dw 提取码: ekkr   安装路径  elasticsearch ： &#x2F;opt&#x2F;elasticsearch-6.3.1 ip地址: 192.168.56.101   解压,建目录,创建用户,修改权限12345678###解压到&#x2F;optsudo tar xf ela">
<meta property="og:type" content="article">
<meta property="og:title" content="centos&#x2F;kylin(yum)安装elasticsearch6.3.1">
<meta property="og:url" content="https://anynone.gitee.io/2021/09/27/elasticsearch-install-kylin-md/index.html">
<meta property="og:site_name" content="anynone">
<meta property="og:description" content="安装包下载 (包含ik分词器)  链接: https:&#x2F;&#x2F;pan.baidu.com&#x2F;s&#x2F;16hZCo46eHkuqW1_HMTj3Dw 提取码: ekkr   安装路径  elasticsearch ： &#x2F;opt&#x2F;elasticsearch-6.3.1 ip地址: 192.168.56.101   解压,建目录,创建用户,修改权限12345678###解压到&#x2F;optsudo tar xf ela">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-09-27T14:32:51.000Z">
<meta property="article:modified_time" content="2022-09-09T00:09:56.415Z">
<meta property="article:author" content="山丘之王">
<meta property="article:tag" content="elasticsearch">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="https://anynone.gitee.io/2021/09/27/elasticsearch-install-kylin-md/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://anynone.gitee.io/2021/09/27/elasticsearch-install-kylin-md/","path":"2021/09/27/elasticsearch-install-kylin-md/","title":"centos/kylin(yum)安装elasticsearch6.3.1"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>centos/kylin(yum)安装elasticsearch6.3.1 | anynone</title>
  




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">anynone</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <img src="/images/head.jpg">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E5%8C%85%E4%B8%8B%E8%BD%BD-%E5%8C%85%E5%90%ABik%E5%88%86%E8%AF%8D%E5%99%A8"><span class="nav-number">1.</span> <span class="nav-text">安装包下载 (包含ik分词器)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E8%B7%AF%E5%BE%84"><span class="nav-number">2.</span> <span class="nav-text">安装路径</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%A7%A3%E5%8E%8B-%E5%BB%BA%E7%9B%AE%E5%BD%95-%E5%88%9B%E5%BB%BA%E7%94%A8%E6%88%B7-%E4%BF%AE%E6%94%B9%E6%9D%83%E9%99%90"><span class="nav-number">3.</span> <span class="nav-text">解压,建目录,创建用户,修改权限</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85ik%E5%88%86%E8%AF%8D%E5%99%A8"><span class="nav-number">4.</span> <span class="nav-text">安装ik分词器</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%94%B9elasticsearch%E9%85%8D%E7%BD%AE"><span class="nav-number">5.</span> <span class="nav-text">改elasticsearch配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BF%AE%E6%94%B9%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="nav-number">6.</span> <span class="nav-text">修改系统配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%90%AF%E5%8A%A8elasticsearch"><span class="nav-number">7.</span> <span class="nav-text">启动elasticsearch</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%A7%A3%E5%8E%8Bkibana%EF%BC%8C%E6%B5%8B%E8%AF%95"><span class="nav-number">8.</span> <span class="nav-text">解压kibana，测试</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%9B%B8%E5%85%B3%E7%AB%AF%E5%8F%A3"><span class="nav-number">9.</span> <span class="nav-text">相关端口</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#systemctl-%E6%9C%8D%E5%8A%A1%E5%8C%96"><span class="nav-number">10.</span> <span class="nav-text">systemctl 服务化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE"><span class="nav-number">11.</span> <span class="nav-text">系统配置</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">山丘之王</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">22</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/anynone" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;anynone" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://anynone.gitee.io/2021/09/27/elasticsearch-install-kylin-md/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="山丘之王">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="anynone">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          centos/kylin(yum)安装elasticsearch6.3.1
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-09-27 22:32:51" itemprop="dateCreated datePublished" datetime="2021-09-27T22:32:51+08:00">2021-09-27</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2022-09-09 08:09:56" itemprop="dateModified" datetime="2022-09-09T08:09:56+08:00">2022-09-09</time>
      </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h3 id="安装包下载-包含ik分词器"><a href="#安装包下载-包含ik分词器" class="headerlink" title="安装包下载 (包含ik分词器)"></a>安装包下载 (包含ik分词器)</h3><blockquote>
<ul>
<li>链接: <a target="_blank" rel="noopener" href="https://pan.baidu.com/s/16hZCo46eHkuqW1_HMTj3Dw">https://pan.baidu.com/s/16hZCo46eHkuqW1_HMTj3Dw</a></li>
<li>提取码: ekkr</li>
</ul>
</blockquote>
<h3 id="安装路径"><a href="#安装路径" class="headerlink" title="安装路径"></a>安装路径</h3><blockquote>
<ul>
<li>elasticsearch ： <code>/opt/elasticsearch-6.3.1</code></li>
<li>ip地址: <code>192.168.56.101</code></li>
</ul>
</blockquote>
<h3 id="解压-建目录-创建用户-修改权限"><a href="#解压-建目录-创建用户-修改权限" class="headerlink" title="解压,建目录,创建用户,修改权限"></a>解压,建目录,创建用户,修改权限</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">###解压到/opt</span></span><br><span class="line">sudo tar xf elasticsearch-6.3.1.tar.gz -C /opt/</span><br><span class="line"><span class="comment">###创建数据目录</span></span><br><span class="line">mkdir /opt/elasticsearch-6.3.1/data</span><br><span class="line"><span class="comment">###创建用户elastic作为执行用户，elastic默认不许用root启动</span></span><br><span class="line">useradd -M -s /bin/nologin elastic</span><br><span class="line"><span class="comment">###修改主目录权限，之后使用elastic用户启动服务</span></span><br><span class="line">chown -R elastic.elastic /opt/elasticsearch-6.3.1</span><br></pre></td></tr></table></figure>
<h3 id="安装ik分词器"><a href="#安装ik分词器" class="headerlink" title="安装ik分词器"></a>安装ik分词器</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">###解压到插件目录</span></span><br><span class="line">unzip elasticsearch-analysis-ik-6.3.1.zip -d /opt/elasticsearch-6.3.1/plugins/ik</span><br></pre></td></tr></table></figure>

<h3 id="改elasticsearch配置"><a href="#改elasticsearch配置" class="headerlink" title="改elasticsearch配置"></a>改elasticsearch配置</h3><ul>
<li>配置文件: /opt/elasticsearch-6.3.1/config/elasticsearch.yml<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">###修改集群名称tjzx-els</span></span><br><span class="line">sed -i <span class="string">&quot;s/#cluster.name: my-application/cluster.name: tjzx-els/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###修改节点名称(不能重复)</span></span><br><span class="line">sed -i <span class="string">&quot;s/#node.name: node-1/node.name: node-1/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###修改数据文件路径</span></span><br><span class="line">sed -i <span class="string">&quot;s/#path.data: \/path\/to\/data/path.data: \/opt\/elasticsearch-6.3.1\/data/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###修改log路径</span></span><br><span class="line">sed -i <span class="string">&quot;s/#path.logs: \/path\/to\/logs/path.logs: \/opt\/elasticsearch-6.3.1\/logs/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###启用内存锁定</span></span><br><span class="line">sed -i <span class="string">&quot;s/#bootstrap.memory_lock: true/bootstrap.memory_lock: true/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###启用系统调用过滤器提高安全性</span></span><br><span class="line">sed -i <span class="string">&#x27;$a\bootstrap.system_call_filter:\ true&#x27;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###禁用机器学习,在linux-aarch64下不能用,其他版本再开启</span></span><br><span class="line"><span class="comment">#X-Pack is not supported and Machine Learning is not available for [linux-aarch64]</span></span><br><span class="line">sed -i <span class="string">&#x27;$a\xpack.ml.enabled:\ false&#x27;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###修改当前主机ip</span></span><br><span class="line">sed -i <span class="string">&quot;s/#network.host: 192.168.0.1/network.host: 192.168.56.101/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###修改监听端口</span></span><br><span class="line">sed -i <span class="string">&quot;s/#http.port: 9200/http.port: 9200/g&quot;</span> elasticsearch.yml</span><br><span class="line"><span class="comment">###配置集群master可以多个,这里自己和自己组成集群</span></span><br><span class="line">sed -i <span class="string">&quot;s/#discovery.zen.ping.unicast.hosts: \[\&quot;host1\&quot;, \&quot;host2\&quot;\]/discovery.zen.ping.unicast.hosts: \[\&quot;192.168.56.101\&quot;\]/g&quot;</span> elasticsearch.yml</span><br></pre></td></tr></table></figure>
<h3 id="修改系统配置文件"><a href="#修改系统配置文件" class="headerlink" title="修改系统配置文件"></a>修改系统配置文件</h3></li>
<li>配置文件: /etc/security/limits.conf 增加配置<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">elastic               soft    nofile          65536</span><br><span class="line">elastic               hard    nofile          65536</span><br><span class="line">elastic               hard    nproc          4096</span><br><span class="line">elastic               soft    nproc          4096</span><br><span class="line">elastic               soft    memlock          unlimited</span><br><span class="line">elastic               hard    memlock          unlimited</span><br></pre></td></tr></table></figure></li>
<li>配置文件: /etc/sysctl.conf 增加配置<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vm.max_map_count=655360</span><br></pre></td></tr></table></figure>
执行<code>sysctl -p</code>并且<code>重新登陆</code>使其生效<h3 id="启动elasticsearch"><a href="#启动elasticsearch" class="headerlink" title="启动elasticsearch"></a>启动elasticsearch</h3>因为不能使用root启动，这里su到elastic用户启动服务<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">su -s /bin/bash elastic</span><br><span class="line">/opt/elasticsearch-6.3.1/bin/elasticsearch -d</span><br></pre></td></tr></table></figure>
<h3 id="解压kibana，测试"><a href="#解压kibana，测试" class="headerlink" title="解压kibana，测试"></a>解压kibana，测试</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">### 解压</span></span><br><span class="line">tar xf kibana-6.3.1-linux-x86_64.tar.gz</span><br><span class="line"><span class="comment">###配置els地址</span></span><br><span class="line">sed -i <span class="string">&quot;s/#elasticsearch.url: \&quot;http:\/\/localhost:9200\&quot;/elasticsearch.url: \&quot;http:\/\/192.168.56.101:9200\&quot;/g&quot;</span> kibana.yml</span><br><span class="line"><span class="comment">### 切换到bin目录， ./kibana启动</span></span><br><span class="line"><span class="comment">### 访问 http://192.168.56.101:5601 进入</span></span><br></pre></td></tr></table></figure>
<h3 id="相关端口"><a href="#相关端口" class="headerlink" title="相关端口"></a>相关端口</h3><table>
<thead>
<tr>
<th>端口</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td>9200</td>
<td>elasticseach服务端口, rest接口</td>
</tr>
<tr>
<td>9300</td>
<td>elasticsearch集群通信端口</td>
</tr>
<tr>
<td>5601</td>
<td>kibana管理界面监听端口</td>
</tr>
</tbody></table>
</li>
</ul>
<p><code>附加开启端口命令</code></p>
<blockquote>
<ul>
<li>iptables -I INPUT -p tcp –dport 9200 -j ACCEPT</li>
<li>iptables -I INPUT -p tcp –dport 9300 -j ACCEPT</li>
<li>iptables -I INPUT -p tcp –dport 5601 -j ACCEPT</li>
</ul>
</blockquote>
<p><code>iptables持久化可以搜索下看看，如果没有，说明还没写</code></p>
<h3 id="systemctl-服务化"><a href="#systemctl-服务化" class="headerlink" title="systemctl 服务化"></a>systemctl 服务化</h3><p><code>这是service文件，复制到相应系统目录</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[Unit]</span><br><span class="line">Description=Elasticsearch</span><br><span class="line">Documentation=http://www.elastic.co</span><br><span class="line">Wants=network-online.target</span><br><span class="line">After=network-online.target</span><br><span class="line"></span><br><span class="line">[Service]</span><br><span class="line">Environment=ES_HOME=/opt/elasticsearch-6.3.1</span><br><span class="line">Environment=ES_PATH_CONF=/opt/elasticsearch-6.3.1/config</span><br><span class="line">Environment=PID_DIR=/opt/elasticsearch-6.3.1</span><br><span class="line"></span><br><span class="line">PIDFile=/opt/elasticsearch-6.3.1/elasticsearch.pid</span><br><span class="line">ExecStartPre=/bin/chown -R elastic.elastic /opt/elasticsearch-6.3.1/</span><br><span class="line">WorkingDirectory=/opt/elasticsearch-6.3.1</span><br><span class="line">User=elastic</span><br><span class="line">ExecStart=/opt/elasticsearch-6.3.1/bin/elasticsearch -p /opt/elasticsearch-6.3.1/elasticsearch.pid</span><br><span class="line">LimitNOFILE=100000</span><br><span class="line">LimitNPROC=100000</span><br><span class="line">LimitMEMLOCK=infinity</span><br><span class="line">[Install]</span><br><span class="line">WantedBy=multi-user.target</span><br></pre></td></tr></table></figure>

<h3 id="系统配置"><a href="#系统配置" class="headerlink" title="系统配置"></a>系统配置</h3><ol>
<li><p>新建用户</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">useradd -M -s /bin/nologin elastic</span><br></pre></td></tr></table></figure></li>
<li><p>修改打开文件和进程数内存锁定大小等 /etc/security/limits.conf</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#执行 ulimit -Sn 查看打开文件数 太小 增加配置如下</span></span><br><span class="line">elastic            soft    nofile          65536</span><br><span class="line"><span class="comment">#执行 ulimit -Hn 查看打开文件数 太小 增加唉配置如下</span></span><br><span class="line">elastic              hard    nofile          65536</span><br><span class="line"><span class="comment">#执行 ulimit -Hu 查看同时打开进程数 太小 增加唉配置如下</span></span><br><span class="line">elastic              hard    nproc          4096</span><br><span class="line"><span class="comment">#执行 ulimit -Su 查看同时打开进程数 太小 增加唉配置如下</span></span><br><span class="line">elastic               soft    nproc          4096</span><br><span class="line"><span class="comment">#执行 ulimit -Sl 查看最大锁定内存数 这是kb， 按照相应机器内存设置，这里设置为不限制</span></span><br><span class="line">elastic               soft    memlock          unlimited</span><br><span class="line">elastic               hard    memlock          unlimited</span><br></pre></td></tr></table></figure></li>
<li><p>修改申请的内存权限大小  /etc/sysctl.conf增加配置</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vm.max_map_count=655360</span><br></pre></td></tr></table></figure></li>
<li><p>新建配置/etc/sysconfig/elasticsearch</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ES_JAVA_OPTS=<span class="string">&quot;-Xms4g -Xmx4g&quot;</span> </span><br><span class="line">MAX_LOCKED_MEMORY=unlimited</span><br></pre></td></tr></table></figure></li>
<li><p><code>systemctl start elasticsearch</code> 启动即可</p>
</li>
</ol>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/elasticsearch/" rel="tag"># elasticsearch</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/09/27/iptables-always-md/" rel="prev" title="centos/ubuntu iptables持久生效">
                  <i class="fa fa-chevron-left"></i> centos/ubuntu iptables持久生效
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/09/27/phalcon-session-md/" rel="next" title="phalcon自定义session_id">
                  phalcon自定义session_id <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 2021 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">山丘之王</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/pisces/" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  





  





</body>
</html>
